updated server example to use callback