Proper use of entitymetadatawrapper
cleanup code