Added grid and snap to grid functionality

Some touch up here and there also