A working version with more explantion