Using array to add extensibility and moved invocation to after function definition