Some refactoring and simple tests for reading different files