Refactored and corrected code and database dump