Cleaned up some code, optim now works for the banded safs