Refactor core code into standalone module and cache results of file parsing.