added generic function to allow deposit and withdraw