Refactored so primary thor file is simple