Improve functional tests and coverage