moved instructions out of the main control flow, streamlined date input