Merge pull request #516 from apathyboy/cleanup

Added support for executing db code on worker threads