revamp as per jim's suggestions