added more methods and did some refactoring