Made more modular, reworked print function