adding error handling and cleaning up a bit.
adding error handling and cleaning up a bit.
adding error handling and cleaning up a bit.
adding error handling and cleaning up a bit.