Finished optimize payment for a given month functionality