Code cleanup as per @jenius's suggestions.