Added methods for error checking.