Refactored duplication of some code and improved the file bootstrap stuff