Add comments, refactor, add waitFg() to bringToForeground()