Fixed bugs + formatted documentation