Add support for optional trailing slash (see #50)