changed to run in foreground