Moving database access to separate file

Keep os access in main
Using real dicitonaires, instead of weirdo lists