Refactoring: Relocting yaml converting in lib

Added tests