Added documentation and some small changes