Documetation improved, code reformated