Code cleanup

-Removed unused functions.
-Cleaned up some comments.
-Formatting fixes.