added foreground server functionality