modifying vineet's code