Started working on the logic