added scripts, some cleanup and using LockGuard