working version.. (But not done yet)