TagCloud: refactor sql to methods