Added Documentation
Fixed several issues
Some re-factoring