Did some modification. May not make sense. Need to revisit