Removed exception handling since it should probably be done differently.