edited clock function and some minor edits