Changed the execClass function to sort out the error caused by directories containing spaces