Fixed bugs, need comments & docstrings