fixed runtime errors, but still need to verify 1st attempt at partitioning