Implemented general logic. Inputs validations done