Updated py implementation and docs