Documentation added, also with some error fixes