begin removing non flattened code