even more rewriting and testing