Cleaning code up a bit