added documentation
fixed some issues