Refactor+fix yaml entitySpec parsing