Added gui renderer and fixed excessive state setting