further cleaning up

mostly type-guided (guaranteed safe) refactoring
Merge pull request #77 from jvoigtlaender/master

further cleaning up