Added code to modularize