Some minor improvements like making variables static.