improve code for out purpose