improved prob6script
deleted extra code
further modularized the code
finished modularizing the code