Refactorized some feature and addedd the db
Minor bugfix