this need to be cammed with setTimeout to emulate the asynchronous behaviour of the real API