Major name refactoring and general refactoring
Minor optimizations (changed indexing method)