Refactored: Removes unused variable, uses only setter and adds tests.