Add some unit and functional tests