Modularize attempt #2