refactor the thor file