added max listeners, internal function updates