renamed distFunc & added javadoc