more integration tests + bug fixes + code cleanup