add momentum and fix tests