Organizing gma elogic out of composeFrame function.