week6 done, still needs some refactoring