Added getDistance method.
Added null check to moveToChunk.
Moved data sanitization into a separate method.