Cleaned up code, added modal controller, added auto_off