added ability to specify final return key type and to be called on event