refactorized code and finished, you can now select the type of object to create from the UI