renamed norm to dist, added proper norm