more major refactoring