Added optinal paramater check to constructor.