commited new mode finding code