Almost completed the first version: working Now populate the Debug macro and test and enhance and optimize