problem04 works, refactor and comment