add code which breaks apart into three scripts