Remove static functions and inject db object