improving clear mem and test structure