Little bit code duplication removed