Fix some naming conflicts and handle exceptions a bit better.