Refactor creation of Text and File instances

fixes #101