Fixed arguement passing by implimenting process wait and removing non needed code