Added the implementation of the legend init function