Modified class with constructor added

Hi, I guess you may not want to modify your original example, but anyway this is my fork of it.