Adding documentation and fixing formatting