update
fix reference var
update
update
ok seems to be roughly wokring