Move server code to a background service

Signed-off-by: Umair Khan <omerjerk@gmail.com>