Used an array for a stack in get_partitions() and got rid of that ugly pointer casting.