Adds database query to handle all paramaters. Improves UI