getting ready to rewrite the code in numpy