Refactoring - put debug and database into sub-pacakages for better compatibility with godoc