adds docs, fixes callbacks conditions, adds code clean up