Added ping and unping functionality

This code, amazingly, follows best practices. It prevents several
classes of bugs