Add type signatures

- fix return value inconsistency exposed by adding types
Improve implementation of onComplete on Future