Rewrite
Debug in progress