Working on...
Added verification of inputs
More verifications
Partially refactored