Error hanling implemented.