starting to modularize code