fixing critical bugs
better docstring