Updated with minor fix to l2 norm computation.