Updated logic and made files executable.