need to convert flags to a global register