refactored svg element creation