improve router path parsing, add support for optional parts