Moved function to index