started modularizing code