changed to_a to use a block so that to_h can use the same logic for free
changed to_a to use a block so that to_h can use the same logic for free
made sure to_a returns array
added hash output and input at the cost of halving to_a speed to keep things dry and dynamic