Some refactoring

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