FE: Code refactoring