Removed generation of some unnecessary database queries