WebGl surface code refactor - still some work to do
Further refactor