Adding function and test