converted functions to mostly-encapsulated objects, further refactored, and simplified implementation of methods.