Finished a working version