major refactor - see README