Some refactoring

- JsDocs
- renamed functions in consistent way
- moved helper functions to the utils
- deleted unused(overheaded) functions
- configurable options