Master merge refactor 2