cleanup code
use macros for memory model checking insteed of functions
use macros whenever possible