Working logic.