Lookup implementation

PR @zancas's work on lookup. PRs make it easy to do code reviews when new commits are pushed.
OK, now uses HTTP status codes.