cleaned up code in index