add optimization functions to repo