continued gradient implementation