Initial code by Tronics