restructuring this a bit. still learning rust :(