feeling bored, beautify the previous code.