Adding mario's work from his repo...hopefully its all intact...