Split off DB part, worked on analysis script.