Added URI parsing according to RFC. Removed locks from callbacks.