Fixed some bugs

Also removed whitespace.