Remove print debug
Fix division by zero when database is empty
Code refactoring