cleanup and adding assertions