rearranged API docs and several fixes in pep-3156 implementation