Bug fixes and controller implmentation