added 4 point condition in new code