Fixed coding style and clearified some comments, following arnavion suggestions