final fixed version