added time stamp code and fixed typos and variables