added the code to link all the files and made working but still to handle edgse cases