Added context parameter to collection functions and updated collection tests