Abstract common codes to top class