Moved common code to gom_internal.h