[WIP] Refactoring

This is an attempt to improve readability and add some tweaks to the existing code.
After this I plan to add the ability to paginate results from search queries if possible but I'd like this to get thru first.

- [x] Docblock refactoring
- [ ] Various tweaks