refactoring of draw element