adapting code for new graphics