Marching sqaures code tidied up and commented