Code clean up

Think of this as the initial commit as if I didn't tell people about it then was asked for code.