Add location as attribute accessor
Improved style, indentation and comments of code