replacing old logic with simple logic