add full functionality and refactor some methods for brevity