some more refacturing in database statements