cleans up controller logic