added getuserbyid and code reorg