Better error handling, added google analytics