add some docs, commentc, checks and functions