Major update with loads of other functions documented; and test cases added