More refactoring, added most methods