use prepare_data() function

Signed-off-by: August Yip <augustyip@gmail.com>