A little house cleaning and refatoring