added R.createArray, better code organization