Merge pull request #27 from rocketu/logic

Fixed database