Adding code from phetsims/scenery