tight up the code a bit