added workqueue and some debugging code