beginning to make a chooser function to replicate current J implementation