Javascript workflow manager - Call method stored in an array