Code cleanup

I did a code cleanup to increase readability and extensibility and fixed some issues on the way. For example support for patch 7.3.629 (`sw` can be set to `-1` to follow `ts`) and using the `stopline` argument of `searchpairpos`.
As this is a near rewrite (although I tested this on my python files) please check that I did not break your use case.
If everything works for you I will try to implement #5.