Removed some comments and added some error catching