Code refactoring on element