Updated and modularized