Renamed file

Added logging and directory checking