code from cs1