Added documentation and fixed style