improved AttrDict in Models, changed tabs to spaces in all files

AttrDict is improved so that it transparently works with a dictionary core. It's more generalized compared to the original version.

I've changed all tabs to spaces as well. This seems to be the standard now.