Added value checking & error handling

* Refactored implicit type conversions