Tightened up code