improve code, remove dulication