Updated documentation, broke up code a little more