Tightening up code