improve code of acess control