Adds docs, refactors some classes