environment-related function moved to end

All environment/version related functions moved towards
the end of the file and grouped together