Modularizing code a bit more