improve code 50%