Added SQL queries and modified views to support multiple "things"