added comments
added script functions to library