Refactored index into modules
Further simplified index
Code reviewed