Last upload of night. Further cleaning up of code.