Small refactors

Refactored to remove some redundant code.