fix background image; refactor/move Identity db code