Some clean-up of non-API classes in BEAM core