Finally got the stupid thing working