Light code refactoring