Grid snap

Added grid snap functions