Made save async and Introduced test function