Initial attemp to avoid blocking startup with db queries.
Removed unused variables - speed up initial db query.