revised per Thiago's suggestion