First seemingly working version