Added subroutine, still coding, have not yet tested the code. Almost complete.