Constructing local integrals of motion in the many-body localized phase