moved ptypes declaration to do-fn declaration