Refactored functional tests