Simplify
Readability
Add some comments
Fix sqlite type capitalization