Added function to get foreground process