Use methods instead of instance variables

Because they are dependent on path.
Fix a scope
Use instance variable for use in local
Extract methods