refined the code sequence