got that function working