Cleaned up controller-code