Added try/catch block to avoid dodginess and lots of errors