After countless hours of debugging..