renamed app class, added debug state switching