Cleaning up dialogue code