took out plotting from main function.