bug fixes, need to write titration optimization function