Refactoring foreground