remove external script and just call the functions directly