modified so that it works with cg_demos