supply the full state, and fix max_result
Fix a bug in the netmask code.

I probably need some kind of unittest for this :)
Add the mixed style.