rewrite tests seem to be working, but theory not treating data correctly