small cleanup
Type simplification
Reordered some parameters for consistency, and also added some additional consistency tests