Uncommenting some code and fixing up some logic.