update logger
split main logic out of cortex to neuropil
adjust code indent