Clean ReST directives
Fix tests and Python 3 compatibility