Fix data load issue. TODO: consolidate code into partial and pass data as locals