Implement filter and state query url

Note: a couple of changes in this file are just line-unwrapping.