First seemingly working version.