Partial working version
Initial implementation