updated readme, created subroutine for reuse