made loadstocks.erl generic