finalized coding code, added time-stamping code (still to do...)