Modularized it and added a few things