Remove handlers before removing nodes in .remove()

This is done so that references that could cause memory leaking
are removed.
Added appendTo + tests