Some cleaning. Added basic error handling to fetching code.