Add functional tests, unit test improvements, fix accompanying bugs