added square detector