some cleanup and version checking