Light functionality code refactoring