splits up index file into modules and adds some tests