Refactor Problems 1 & 2