Add comments & refactor to be more modular