added syntax to pass a hash into the subroutine
fix a few problems. the subroutine is now working.