refactored the getKey switch statement used by factory to call methods
that handle its details.(creating errors)