Integration-tests

PR for #875 with review comments