added delay support
commuted out debug code