task1 code; not tested