call expire function before writing the new version to make sure to have enough free space
it is enough to call the expire function once
also expire versions on rename, to update the history more regularly
fix typo in comment
adjust comments
fix some var names according to our style guide
continue cleaning-up old versions if availableSpace=0. It's not necessary but gives us some additional free space, especially in the case of a hard quota
fix array access and change variable names according to the coding style