Dense sub-graphs of sparse graphs (communities), which appear in most real-world complex networks, play an important role in many contexts. Most existing community detection algorithms produce a hierarchical structure of community and seek a partition into communities that optimizes a given quality function. We propose new methods to improve the results of any of these algorithms. First we show how to optimize a general class of additive quality functions (containing the modularity, the performance, and a new similarity based quality function we propose) over a larger set of partitions than the classical methods. Moreover, we define new multiscale quality functions which make it possible to detect the different scales at which meaningful community structures appear, while classical approaches find only one partition.