add documentation and a run function