support for switching modes
added pattern checker