Fix/systematic prototypes

More fixes for tests, and a re-org of prototype handling. Review by @DarkDimius, @samuelgruetter