re-write almost