Converted to factory
Added date based question