Updated with my working version