A rather large commit. Got functional tests working