Uses sql-query for SQL query building, removes unnecessary files, fixes some tests