Fixed a little bug and add momentum term