Added some documentation
Extreme refactor