Modified code structure, fixed barnes Hut bugs