Change delegate method names. Fix some bugs