Some code correction, added doc strings. Updated gitignore.