Rewrite, add many more validations

Fixes #21
Fixes #24
Fixes #25