added basic mode recognition