Moved to a group model for better representation of entities in the svg element

* Moved to a group model where an entity is represented in the svg
element as a circle with a label. This fixed inconsitancies where a
label from a circle behind another circle would appear on top of the
circle on top (quite noticable in transistions)
* Removed some code duplication
Merge branch 'gh-pages'