Made function compare(), ready to use(not tested)