Some handy routines for protocols implementation