Alot changed and hopefully doesn't break anything.

Implemented database