version nearly working