refactored functional test to be more modular