Remove code duplication in index file and create separate directory for PHP include files.