code refactoring and improvements in database classes
merged the pull
ödsaljkfaslkfjaskldjf