refactored functional test