Crashes due to shared access

This really needs refactoring