Expanded replacement and extension of the optim function

WWW: https://github.com/nashjc/optimx
