Got something basic working

It is probably horribly inefficient right now, but it appears to be working how it should.