Added some doc but also corrected a small bug that prevented substitution from happening