Index now fully functional. Code needs cleanup
Fixed index handling bugs. Cleaned up code. Refactored grid into it's own module.
code cleanup