start of significant refactor