tweak code according to review