function getState() public constant returns (State) {
        
        if (isSuccessOver) return State.Success;

        
        if (isRefundingEnabled) return State.Refunding;

        
        if (block.timestamp < firstStageStartsAt) return State.PreFunding;

        
        if (!isFirstStageFinalized){
            
            bool isFirstStageTime = block.timestamp >= firstStageStartsAt && block.timestamp <= firstStageEndsAt;

            
            if (isFirstStageTime) return State.FirstStageFunding;
            
            else return State.FirstStageEnd;

        } else {

            
            if(block.timestamp < secondStageStartsAt)return State.FirstStageEnd;

            
            bool isSecondStageTime = block.timestamp >= secondStageStartsAt && block.timestamp <= secondStageEndsAt;

            
            if (isSecondStageFinalized){

                
                if (isSoftCapGoalReached())return State.Success;
                
                else return State.Failure;

            }else{

                
                if (isSecondStageTime)return State.SecondStageFunding;
                
                else return State.SecondStageEnd;

            }
        }
    }