Refactor functional tests into separate files. Passing test suite