Added DB methods
Rewrote some configuration handling