Fixed a minor locking bug and added clearing capabilities.