Added test for YamlReader and refactored code