Add comments and convert to library