Major worker refactoring. Worker and database logic redone. Database classes modified.