Refactored dimensionality reduction for future additions

Signed-off-by: Jimmy Yu <jimmy.w.j.yu@gmail.com>