First half-way working version