Changed how classes are retrieved

made use of the metadata factory methods to get entity classes - slims code down and is faster 
On this line, you have the excess space and also Array() uppercased.