Code cleanup (as per @redmunds suggestions)