added documentation, comments, tidied up arf+