Clerical fixes and more refactoring

Went through code and updated everything.