cleaned up code and fixed issue with chamfer