made code more modular