Refectored and corrected major configuration issue