General code cleanup

removed excess code fragments from past builds and added more comments