documantation in progress, minor cleaning of code