Remove unnecessary code in index. Organize