tightened up code