fixed directory check function
removed old main function