Fixed location retrieval.
Fixed undefined id issue.
Cleaned up issues in parsing code.