adding documentation and fixing instance variables