adding optimizer from sam lendle