Tried to make things more modular.