Added E2 functions, bug fixes, small improvements