make code a bit more modular