add script lattes to lib folder and fix some coupling