added an Element typeclass, moved some element stuff to unsafe