Tightening up the code a bit