Refactor location, filename, and klabel attributes

**please review**
Are you sure this is right? Please double check.