Is it possible to implement this so that an exception is thrown if you get it wrong?