starting the logic