first version of loadSource funcition