Better structure

Cleaner and easier to maintain.
Hmm, maybe add a custom property to the error? Like `err.expected = true` or something. Need a better property name though.