All done, made more efficient with locking