Minor Changes,

Created functions, moved code out of main rout...