added most of the code for the multithreading ghosts, but some errors
prevent it from running. Looks okay though