Changed visibility on instancevariables and small refactoring