refactor to use isCmd helper
refactor to use symbolic conditionals
add malloc/realloc wrappers
use realloc wrappers
remove unneeded includes
remove assert include
add wrappers for log output
use log output wrappers