Make use of local variable as intended
Refactor tests for improved efficiency and code reuse