Changed the implmentation of how command is executed in a directory