modified code

moved the creation of the class to a shared method
renamed instance properties