Cleaned up controller slightly