clean up code style and custom errors
1.0.0-beta