Implemented the code for the Widget.