Rewrite #2, #3, #4 and added #5 and #6