final testing and getting output working along with error handling