Finished the code for local.