moved class methods to instance and made some methods clearer