added sampling of nuclide and move subroutines around