Added file locking