Refs #3809 - Remove useless assignments

This removes a lot of variables that occupied space in memory for nothing, and I added some debug + backtrace for some exceptions.
Exceptions are not good for flow control, but if you say it's not an error, than warn or info would be more appropriate I think. Only in case it generates lots of messages we should go with debug (or trace which is not supported by Rails I think).