Made refactoring and added filtering for queries for booked tickets