Pretty much equivalent functionally to what I had previously written in C with the added bonuses of no segmentation faults and a lot more readable code.