some changes to code for random init