added loaddata function