Moved the logic