database functions and views adjustments
move response processing out of conditional