Adding new flagging algorithm that will restore old way of doing flags