Made auth unit optional. Cleanup db initialization. Added compatibility with new resource concept