Tracking the formation of methylammonium lead triiodide perovskite