Better parameter parsing

The old parsing system had some bugs. This one is faster and less buggy.