Implementation of surface weighting

Also fixed total weight normalization