restructured code to make multiple levels and phone interface less hacky