Added (basic) support for nth-child selector
Fixed other miscellaneous bugs.