Semi working code.