slight fixes, demo now producing valid code