This class is getting really long. Perhaps this could be separated to a new class?