beginning attempts at modularizing code