RF: finalize code and added doc-strings