cleaned up controller