added sending size of data into function