Implement add and remove methods on hat.prototype