Implemented more validations and finished computation code on server side.