More porting

Still pulling in previously written code. Hopefully making sense.