Rewrite params and add unittests