Feature: Documentation

- cleans up some code
- adds jsdoc documentation to some methods