Fixed TypeError and added documentation

Closes #1033