Refactor first step, add common package and refactor exceptions.