Improved tests
Added functional tests for #162