Refactored duplicate code out into a new method.
Moved some variable initialization into the setDefaultProperties method.