tightening code up a bit