Spliting up main

Adding documentation
Using functions to make comments implicit