incorpporated some of sameer's changes