Changed delegate callbacks for easier implementation of custom functions.