merged changes from Stunner #9

Added the error handling changes from Stunner #9, but also added
methods to maintain backwards compatbility.