refactoring to reduce some of the file sizes