Ported a few functions; still learning a lot about rust!