Google docs & cleanup

Did a big cleanup of code, sorry for all the minor changes