Fix bug where certain factory methods assume new operator will throw on class not found (fatal error occurs). Use class_exists to check and then throw exception.
Refactor factory methods into base Factory type for ease of testing.