Create subroutine for dir check
Add subroutines