Fixed a bug in hasLocation-method
More comments and some memory optimization