We describe our ongoing project to investigate the effect of cluster and field environments on the formation of S0 galaxies. Accurate models of a large sample of S0 galaxies will allow us to map different properties of these galaxies. GALFIT — a two-dimensional image decomposition program, will be used to model S0 galaxies using a Sersic profile since we find it the most appropriate function among the available standard galaxy profiles. Since input parameters affect the accuracy of fit model, different combinations of parameters are tested for each S0 galaxy to obtain the best-fit model. A python code was developed to identify the location of cluster S0 galaxies based on their right ascension (RA) and declination (Dec). Images were cropped to minimize the effect of surrounding objects. A separate algorithm was used to extract input parameters, such as the galaxy centroid, half-light radius, etc., from cropped images of S0 galaxies. To accurately model a large sample of S0 galaxies, the GALFIT fitting process was automated by using a python program. The program is capable of automatically constructing models by varying parameters such as the axis ratio and position angle within a given range. The created models and residual images were analyzed by using a python program that automatically filters the best-fit model based on the reduced chi-square (χv2) and by measuring the quality of the residual image. The implemented algorithms were tested by using a sample of cluster S0 galaxies selected from Dressler’s 1980 catalogue with their respective observed images taken at the Kitt Peak National Observatory (KPNO) using the 0.9-m telescope with a 2048 x 2048 pixel T2K CCD. This modeling process will allow us to compare and contrast a large sample of S0 galaxies and unveil the effect of the cluster environment on S0 galaxy formation.