auto formatted and code reviewed mesh.js