Added implementation and testing document  and more inline comments. Cleaned up unused stuff