Separating Density Algorithm into its own classes