Also add a version check, just in case.
This is a big commit, but a necessary one, as too many things were intertwined. As a result, the code is now cleaner.