Refactor data structures for better multiple file-type support