Refactoring: moved variables to the top in Frontend.