Modularized the code a little bit more