Added some controller logic, still incomplete