Adding better logic