updated documentation. changed tpx to ifelse