3.1. Formation and characteristics of developed aerobic granules
The development of AGS diatomite is different from natural granulation process (AGS control). Both granules were successfully formed in this study. The formation and characteristic of both granules were displayed in Table 1. It is important to highlight that the time taken to achieve granulation is the main difference between both types of granules. The transformation of AGS diatomite and AGS control was shown in Figure 2 and Figure 3. AGS control took a significantly longer period to become the granule. While, in an only short period, the loose and fluffy morphology of the inoculated seed sludge (Figure 2a) suddenly evolves into big and compact granules as shown in Figure 2d. It was noted that at the beginning of the experiment, both developed granules have the same startup condition with the majority of the sludge was considered flocculent sludge size of less than 0.3 mm. In just 10 days, the diatomite effect was already noticed. A huge number of small granules was observed in the bioreactor system (Figure 2b). 70% granulation rate was recorded and only 30% of flocculent sludges were left in the system. A near majority (46.4%) of the sludge was in the range of 0.3 to 0.6 mm size. The granules colour varies from yellow, light brown and dark brown. This rapid transition of seed sludge to granular sludge indicates the influence of diatomite functioning as a carrier and nucleation agent for the granulation process. According to Sarma et al. , the first phase of AGS formation (cell to cell interaction), normally takes a long period before entering the second phase (micro aggregate formation). This could be seen by the control AGS having a passive granulation rate since the start of the experiment. The similar transformation could only be achieved after more than 50 days of the experiment. In day 10, the granulation rate of AGS control was 28% and majority of the sludges, 77% were in flocculent state (0-0.3 mm size).
Subsequently, the development of AGS was highly connected to the advancement of biomass and SVI in this stage. AGS diatomite recorded MLVSS/MLSS ratio of 0.67 and SVI5/ SVI30 of 0.67 while AGS control achieved 0.5 and 0.61 respectively. AGS diatomite clearly have a better ration for both biomass and settling properties compared to AGS control. The rapid enhancement of both settling ability and biomass concentration was presumably have something related to the presence of diatomite. Zhang et al.  in his study on the effect of diatomite towards the treatment of coal gasification wastewater stated that diatomite promotes the biomass and boost the performance of sludge settling. It was probably due to the high adsorption capability of diatomite to agglomerates with the bacteria and organic matter which result in faster settling rate. Diatomite plays a critical role in initiating the aggregation process during this early stage. Due to its chemical composition and microstructure, the surface of diatomite creates a Beta potential that could neutralise other particles. The beta potential enabled the particles to be adsorbed to the diatomite and agglomerated to become a floc and small granules . With the achievement of initial aggregation, the subsequent granulations are easy to proceed .
Later, the AGS diatomite continues to develop and undergo clear morphological transformation becoming more compact and smoother surface. Ultimately, aerobic granulation for AGS diatomite was successfully achieved within 20 days as the granulation rate stabilized above 90%. According to Long et al , the aerobic granulation could be considered successful when the granulation rate firstly accounted for 90% of the total sludge in the bioreactor system. In this study, 92% of granulation rate was recorded at day 20 with AGS diatomite appeared bigger in size and solid structure The colour of the granules was shifted into a single dark brown as compared to previous cases. In this stage, the numbers of developed AGS diatomite inside the bioreactor were rapidly increased. On day 25, majority of sludges in the bioreactor consisting AGS diatomite were 0.6 to 1 mm in diameter. Correspondingly, the performance of the system towards the settling ability and the removal of organics and nutrients also became more efficient. Starting from day 25 onwards, the granulation rate and performance of the bioreactor were stable and maintained until the last day of the experiment (day 50). Mature granules with a bigger, compact and smooth surface were visualized on the 30th day as shown in Figure 2d. At day 50, vast majority (56.7%) of the AGS diatomite size ranging from 1 to 4 mm and achieved a desired SVI5 of 52.8 mL/g SS which indicates high settling ability in the system. Referring to Ren et al. , the average SVI of high-quality granular biomass was less than 60 mL/g SS. Thus, AGS diatomite could be categorized in the group of high settling performance granules.
Meanwhile for AGS control on day 50, the majority (42%) of them was still flocculent sludge with less than 0.3 mm size. The SVI5 of AGS control was 102.3 mL/g SS and considered to be poor settling performance compared to AGS diatomite. At the end of the experiment (93 days), the SVI5 of 81 mg L-1 SS was recorded and majority of the sludges have turn into small granules (1-1.4 mm). Remarkably, the feat that was achieved by AGS controlled at the end of bioreactor operation, was easily attained by AGS diatomite in less than 21 days. AGS diatomite accomplishes 92% of granulation rate at day 20 while AGS controlled approximately 85 days. Notably, the contrast towards the aerobic granulation period for both granules was distinct with 65 days’ difference. In comparison with other support material such as zeolite  (90 days) and Granular activated carbon (GAC)  (6 weeks reduce to 3 weeks), the rapid granulation achieved with the addition of diatomite was clearly higher. Prominently, the short duration of AGS diatomite formation enhanced the sustainability of the treatment and at the same time, improving the efficiency and effectiveness of the system.
3.2. SEM analysis
Later, the inner and outer layer structures of 4 mm (diameter) AGS diatomite was visually examined via SEM after 50 days of cultivation. This method explores the whole granular structure, involving surface morphologies, bacterial cluster, as well as filamentous and extracellular polymeric substances (EPS) matrix that associated in the development of AGS diatomite. According to Othman , a different condition such as bioreactor technical set up, a different type of wastewater, or even different strategies to promotes granulation process could result in different microbial structures of granules. This study revealed the effect of diatomite on the structure of the granules in comparison to the controlled AGS. The SEM result illustrated the outer layer of AGS diatomite and identified various species of bacteria dominates the surface area. The most apparent bacteria among them were cocci-shape bacteria. The bacteria were observed occupying the granules as a single cell as well as a large group cell as shown in Figure 4a. Correspondingly, both granules displayed an irregular arrangement of cocci-colonies embedded with thick EPS matrix in a dense cluster. According to Zhang et al. , cocci-shaped bacteria functioned as a supporting consortium for the AGS development and normally exist in bigger size granules. Likewise, there were a lot of studies related to granulation found the same findings indicating the presence of cocci colonies in AGS [17;29].
Another element that detected throughout the AGS diatomite surface was Extracellular Polysaccharide Substances (EPS) as illustrated in Figure 4.3. The EPS appeared soft in texture with glue-like structures. According to Chen et al. , EPS is a complex mixture of polymers that normally present on the microbial cell surface, plays a crucial role in facilitating AGS formation by keeping the microbial aggregates bind together. In other words, this EPS produced by the microbes is a key component for the granulation process as its composition was similar to a biofilm structure. The major components of EPS are Polysaccharides (PS) and proteins (PN), mainly involved in altering the physicochemical properties of sludge in biological wastewater . Both PS and PN components were expressed in term of PN/PS ratio. As explained by Jiang et al. , the production of EPS was enhanced together with the granulation process as a reaction from the increasing trend of PN/PS ratio. Throughout the SEM observation, the EPS was seen on the surface and inner part of AGS diatomite, while the EPS in controlled AGS seems to accumulate more at the inner layer of granules compare to the surface. Other than microbes and EPS, a lot of micropores were observed during the SEM analysis. These micropores were known as cavities and located in any part of AGS diatomite surface adjacent to bacteria clusters. According to Ab Halim et al , the cavities were formed due to the continuous flow of liquid produce by EPS and microbes activities close to the internal part of granules. This channel-like structure cavities, act as a transportation passage delivering the needs such as nutrients, oxygen and substrates to the inner part including the core of the granules. The presence of multiple cavities ensure enough supply of needs for every granules component and lead to a rapid granular formation with high stability characteristic. This could be one of the factors that influence the rapid granulation of AGS diatomite. The formation of compact AGS diatomite, at the same time, possess porous structure consisting of loads of cavities might have some relationship with diatomite addition. The presence of diatomite presumably boosts the numbers of bacteria which enhance EPS secretion. Therefore, both components caused the formation of cavities that ensure healthy granules development.
Apart from that, a closer observation towards the inner part of AGS diatomite discovered more than one diatomite was appeared at different location of the granules as compared to none in AGS controlled, which undergo a natural process to become granules. Figure 5a illustrates the image of a single diatomite, it was noticed that the surface of diatomite was enclosed and tightly bonded with microbial cells and EPS. This circumstance verified the role of diatomite as a carrier and nucleation agent during the formation of AGS. Similar observation by Chen et al.  reported the diatomite was found in the centre of the granular sludge and act as a substrate for the microbes. Also, two different types of diatomite were found in the granules, they are centric and pennate based primarily on cell shape and frustule morphology. Centric typically have a discoid or cylindrical shape, with radial symmetry, as well as longitudinal and transverse axes as shown in Figure 4b. While pennate have a range of shapes from elongated to filiform (Figure 4c). In the comparison of both diatomite figures, the microbial cells were more attracted to pennate diatomite compared to Centric diatomite. The microbes enclosed nearly 75% of the pennate diatomite while in centric diatomite, only the side part was filled and attached with microbes. The result was comparable with Van Leeuwe et al. , claiming that the microbes clearly dominated the pennate diatomite but less abundant in centric diatomite. According to Măicăneanu et al. , the pennate diatomite has superior technical properties, that elevates the adsorption ability. In the SEM analysis, the pennate diatomite was discovered to have open-pores dispersed in clay matrix. The pores and open voids provide natural filtration and adsorption properties to the pennate diatomite compare to centric diatomite. Besides, with more than one diatomite were discovered in the 4 mm diameter granules, it was believed that each diatomite and microbial cells undergoing aggregation process to form one small aggregate. Afterwards, it was bonded by EPS together with other aggregates filled with diatomite as the nuclei, to formed larger granules. Therefore, the AGS formation was presumably catalyst by the existence of diatomite.
3.3. Removal performance of AGS control and AGS diatomite
In this section, the removal performance of COD, PO4-P, NH3-N and TIN of both types of granules were compared throughout the experiment. It was noted that the performance of AGS diatomite was on par with controlled after the system achieved stable state condition. However, an important element to be highlighted was the significant difference in the duration of the experiment with AGS diatomite in 50 days while controlled, 93 days. It shows the capability of AGS diatomite to effectively removed the pollutants and ensure the stability of the treatment system within a short period.
3.3.1. Chemical oxygen demand removal
The performance of AGS diatomite towards the elimination of organic matter (COD) from the treatment system during the whole period of bioreactor operation was displayed in Figure 6. As shown in the figure, the overall profile of COD removal performance indicates satisfying performance since the beginning of the experiment and rapidly increased achieving more than 90% removals before stabilized to a steady-state after a short period. Different circumstances occurred in the controlled experiment as it took a long period to accomplish stable removal performance. Nevertheless, it was noticed that the COD removal performance successfully stabilized at advance levels after both AGS achieved granulation.
During the early stage of the experiment, the bioreactor cultivating AGS diatomite already demonstrated better performance with the average COD removal percentage beyond 70% compared to control with only 46%. The effluent COD also lower than controlled for the first 10 days. Two factors might influence this condition. Firstly, it was due to the differences in the influent COD concentration with the controlled average influent COD was higher than the latter. This condition was due to the additional residential areas (Construction for other Sewage treatment plant) that contributes towards the increase of raw sewage concentration in Bunus STP. The average influent COD concentration for controlled was 335 mg L-1 while the AGS diatomite bioreactor recorded only 175 mg L-1 for the first 10 days of the experiment. However, the low concentration of COD normally have lower removal percentages because of the difficulties of achieving low concentration COD. Therefore, the biggest factor might be the aftermath of diatomite addition. It was mentioned by Xu et al  that diatomite high adsorption capability of organic matter. Diatomite surface comprised of electronegative charged that managed to absorb the cationic organic chains. The organic chains then shrunk and attached to the diatomite. This could highly reduce the concentration of suspended organic matter (in term of COD) in the treated effluent.
Afterwards, the COD removal performance was drastically increased in a short period. The performance achieved the highest of 91% COD removal percentages after only 22 days of the experiment. Meanwhile, different circumstances occurred in the controlled experiment as it only recorded 67.2% COD removals. This achievement has a strong relationship with the granulation process as high numbers of mature granules would surely enhance the system performance. This was supported by the fact that the granulation rate for AGS diatomite accomplished 92% while controlled, only a handful of 43%. According to Rosman , one of the reasons behind the high COD removal performance was numerous contacts between the granules and surrounding particles. It enhances the granules to mineralize organic matter and intermetabolites in the bioreactor. In this case, the presence of diatomite which possessed high adsorption ability could intensify the contact between the particles and microbes that attach to its surface and effectively increased the COD removal performance.
In the 25th day until the end of the experiment (day 50), the COD removal performance was stabilized with a range of 83–90%. The performance could be considered excellent achievement as a vast amount of organic matter were removed from the supernatant. The stable performance was also supported by 0.8 MLVSS/MLSS ratio obtained in the final day of bioreactor operation which demonstrated the optimum level of organic and inorganic solids in the system. In comparison, the controlled AGS attained only 70% removal after 50 days of the experiment. It finally accomplished the same feat as AGS diatomite after a long period of 93 days. The accomplishment of AGS diatomite in this study was comparable to Chen et al , that developed granules with the presence of diatomite for treating petroleum wastewater. The author mentioned that diatomite greatly improved the system due to its’ unique characteristic, high surface area and high adsorption capacity. With those advantages, the particulate substrates were effectively removed by adsorption processes at the granule surface, followed by hydrolysis. As for the effluent quality, the average COD concentration after the treatment met the sewage discharge standard A, (COD <120 mg L-1) as regulated in Environmental Quality (Sewage) Regulations Malaysia (2009).
3.3.2. Phosphate removal
In general, the elimination of phosphorus demands alternating anaerobic-aerobic condition (Bassin et al, 2019). It suits the application of granulation technologies in the SBR system that consists of non-mixed anaerobic feeding phase, aeration phase, settling phase and effluent withdrawal. Both AGS diatomite and controlled were developed in the same system and the presence was the biggest factor separating the two. In this study, the PO4-P removal performance profile for AGS diatomite was illustrated in Figure 7. The overall pattern of PO4-P profile indicates increasing removal performance after going through rapid granulation process. In the earlier 10 days of operation, both types of bioreactor recorded a very low PO4-P removal performance averaging only 30–40%. The low-performance issue was also experienced by Ab Halim et al  with PO4-P removal of 30 to 50%. It was suggested that the sludge was still going through an adaptation phase in this period. The microbes in the sludge do not grow instantly after the start-up process and required a certain amount of time to adopt a new living environment.
In the period between 9 to 18 days, there is a significant rise in phosphate removal performance from 32–56% showing positive changes after AGS diatomite formation implying its’ capability for phosphorus biodegradation. According to Nancharaiah and Reddy , for low strength real domestic wastewater, a small concentration of substrates is a limiting factor for phosphorus removal process which required COD. This obstacle could be hindered with the enrichment of microbes in granules that able to simultaneously undergo denitrification and phosphate removal. Interestingly, the rapid increased of phosphate removal performance for AGS diatomite might have some relation to this theory. The presence of diatomite possibly attracted polyphosphate-accumulating organisms (PAO) to attach to the granules and grows. The PAO stored the influent organic matter as intracellular polymers during the influent feeding period (anaerobic condition), and remove it from the wastewater in the aeration phase.
The removal performance kept increasing until it reached 74% at the end of the experiment. Meanwhile, controlled AGS recorded 70% removals after 93 days of the experiment. AGS diatomite has a better PO4-P removal performance compared to control with a significantly shorter period. Furthermore, a study conducted by Zhang et al  towards the ability of diatomite in nutrient removals from agricultural wastewater also proved the effectiveness of diatomite for PO4-P removals. The removal performance of PO4-P with the addition of diatomite was reportedly more than 88%. The mechanism for the removals was via chemical adsorption which involves valence forces or electron exchanges. This suggests two different abilities for diatomite in removing phosphate, involving biological and chemical adsorption. Yet, the performances of AGS diatomite in removing PO4-P were still average compared to other parameters at the end of the experiment. According to Nancharaiah and Reddy , this incident seemingly due to the fair amount of PAO which result in passive bioactivity of the organisms in the bioreactor. Nevertheless, AGS diatomite illustrated the increasing pattern of removal as compared to control which indicates its’ potential to achieve exceptional performance in the long run.
3.3.3. Complete removal of nitrogen comprises nitrification and denitrification process.
Generally, AGS is well known for its capability in undergoing both processes simultaneously which led to an effective nitrogen removal for the treatment. In this study, the nitrogen removal performance was analysed and compared between AGS diatomite and AGS controlled. The nitrogen removal was measured in term of TIN and NH3-N. The profiles removals for both parameters were shown in Figure 8 respectively. As illustrated in the figures, the first weeks of the experiment indicate average TIN removal performance for AGS diatomite, managing less than 70% removal percentage. It was probably due to the low influent COD concentration that reduces the denitrification ability and affect the low removal of NO2-N and NO3-N . However, the removal percentage of NH3-N displays a positive sign given that the performance kept on increasing and achieved more than 70%, suspected due to diatomite addition. The performance was comparable to AGS controlled achieving an average of 69% removal percentages for both TIN and NH3-N parameter in the beginning, 7 to 10 days of the experiment.
The subsequent period demonstrated large numbers of granules were formed in AGS diatomite bioreactor at day 20. Surprisingly, in this short period, it already accomplished the state of granulation after successfully attained a granulation rate of 92%. The advancement of AGS in the system undoubtedly influences the enrichment of nitrifying bacteria that responsible for nitrogen degradations. As a result, TIN and NH3-N removal performance increased exponentially just after 20 days of experiment achieving 72% and 87% removals respectively. This condition proved the effect of diatomite towards rapid granulation and at the same time enhanced the system to perform efficiently. Correspondingly, Basri et al  mentioned the process of granules formation could enhance the growth of nitrifying bacteria and improved the nitrification process which might be the case of this study. Furthermore, according to Derlon et al , the extent of simultaneous nitrification-denitrification was directly associated with the fraction of granules that exposed to the anoxic condition. In this case, the diameter of the granules was already in the range of 0.6 to 1 mm at day 14 proving the effectiveness of the removal performance of TIN and NH3-N from that period onwards.
Starting from day 33, the NH3-N was kept above 87% while TIN, 76% until the end of the experiment. The AGS diatomite reached the highest removal of 93% and 85% for NH3-N and TIN respectively. Notably, the maturation of AGS enhance the removal performance with the presence of aerobic and anaerobic/anoxic layers, which make the granules able to carry out the removal of carbon, nitrogen, and phosphorous simultaneously . Specifically, the performance was highly influenced by the population of nitrifiers and denitrifiers (slow growers) . Xia et al  stated ammonia-oxidizing bacteria (AOB) responsible for ammonia removals primarily located at the outer layer of granules while nitrite-oxidizing bacteria (NOB) normally reside in the inner layer. Large size granules presumably favour AOB growth and cause inhibition to NOB growth. The ratio of AOB to NOB in the granules also rise along with the increase in AGS size. This explained the excellent performance of AGS diatomite in removing NH3-N compared to TIN in this study.
Eventually, both AGS successfully achieved excellent removal of NH3-N with more than 90% removal percentages at the end of the experiment. To achieve such a feat in a short period, AGS diatomite was seen as the better performer compared to control. Previously, Dong et al  conducted a study to investigate the performance of diatomite in removing NH3-N in coking wastewater. The result indicates excellent NH3-N removals with more than 90% removal percentage. This suggests that diatomite might be one of the main factors enhancing the ammonia removal performances for AGS diatomite. Nonetheless, controlled AGS recorded a better TIN removal performance compared to AGS diatomite. Liu et al  explained that to ensure the excellent simultaneous performance of NH3-N, NO3--N and NO2--N removal, sufficient microbial load was needed and demanded a longer duration. In this case, AGS controlled going through a significantly longer period to accomplish the desired state as compared to AGS diatomite. This condition was one of the main reasons for control to have a slightly better performance than AGS diatomite in term of nitrogen removal. Even so, the excellent biological activity of the microbes in the AGS diatomite could ensure a better nitrogen removal performance in the future.