Added Index and fixed formatting. May be moving the query code to its
own class...