Added distance to interface and optimized Class analysis

@jdereg 
i've just added the features to a proper pull request. My code formatter changed the whole source code -> disabled it.