cleaned up controller and got rid of redundant variables.