Added index function
Index allows calls with function as argument or without it