some really terrible code
Revamped to use optional ptrs
Move args around
Small fixes