Cleaned up writeLocal
Cleaned up writeLocal