added some documentation and organized the code a bit. Still requires additional missing class documentation