Code rewritten with entity metadata wrappers
Merge branch 'missing_library'