Updated to allow text to be passed to the constructor.