refactor rendering as class
extract constants
caller creates svg element
caller calls ajax
fix indentation