Refactor add somethings from Anton's solution