Added unit test for attr_fn_arst and fixed a few bugs in the code.