Refactoring, formatting and changing queries to typed queries