Added more padding and correct error handling.