done issue #50; work on issue #41; improved memory defines to maximize speed