Added tests for rebuilding the function properly