Initial code import after some late night haxxing