Initial working code with a built in controller