Identifying and controlling phase purity in 2D hybrid perovskite thin films