moved rendering of element into element class;