purify the code