refactor with mws error checking and product existence checking