Tried to make it more modular