Major code cleanup

Removed unused functions
Mark functions that don't change data members as const
Use static functions instead of singleton for classes without data
members