This work deals with the enhancement of the coherence properties of nitrogen vacancy (NV) centers in diamond. Both materials science and quantum engineering methods are investigated, in particular to extend the transverse relaxation time T2 of very shallowly implanted (~10 nm) NV centers. NV centers are a mechanically and chemically highly robust system, due to the lattice comprising them: diamond. Diamond itself is a very rare raw material in nature. Since 1955, however, diamond can be artificially produced commercially, and since the late 1980s it can be produced in a highly pure form by chemical vapor deposition. This allows us today to introduce and study quasi-isolated defects at any depth. One of these defects is the NV center, which consists of a single nitrogen atom and an adjacent defect in the carbon lattice. With optical excitation, a single such atomic-sized defect can be seen in a confocal microscope or EMCCD camera. The exciting thing to note here is that this luminosity depends on the quantum state of the electron spin of the NV center. This quantum state is manipulable at room temperature and in air atmosphere and detectable by the emitted light. The quantum state couples to magnetic fields, making it an exciting quantum sensor of the spins of its atomic environment. For this reason, it is of particular interest to implant NV centers as flat as possible. This also allows spins to be detected outside the diamond lattice, for example, when a molecule is positioned on the diamond surface directly above the NV center. However, the detection methods usually used require the longest possible transverse relaxation time T2. However, the closer the NV center is to the surface, the shorter its T2 time statistically becomes. The cause of this problem is currently not completely understood. One solution would be to implant the NV center as deep as possible, but this would again severely diminish the sensitivity to surface molecules. The present work addresses this dilemma. First, it investigates two possible causes for the reduced T2 time of near-surface NV centers: the surface morphology and the charge density during the formation of NV centers. For the study of surface morphology, polishing techniques from different substrate manufacturers, as well as state-of-the-art chemical mechanical polishing techniques are compared. In the process, the resulting surface morphologies are examined in an atomic force microscope and subsequently correlated with the statistical evaluation of the T2 times of near-surface NV centers. In order to achieve the highest possible throughput, a wide-field microscopy setup for NV centers is being developed specifically for this purpose, allowing evaluation on up to 100 NV centers simultaneously. To investigate the influence of surface charge density, different metallic layers are deposited on the diamond surface or different chemical surface terminations are applied before NV shaping is performed. For one sample, excess electron charges are also removed with a UV laser during NV shaping. Finally, the resulting statistical evaluation of the T2 times is correlated with the preparation method. In the last part of this work, instead of extending the actual T2 time of the NV center, the effectively usable T2 time is improved under the influence of a classical perturbation source. Here, one exploits the fact that a measurable perturbation source has a well-defined influence on the quantum state and can thus be understood as a logic gate. The effect of this gate can be subsequently taken into account to measure the unperturbed state. The use of this method to an imaging technique with sub-optical resolution is demonstrated at the end.