prior to modularizing

working code but not well structured