Most of the final code for GR4