WIP for CPS with globals