Some moving around of functions and cleanup, preparing to move to NSKeyedArchiver