Replaced switch statement with creation by the factory

Had to rename, create new classes and delete the old ones because egit
didn't recognize my changes