Fixed logic. It was working bad.