process forking added, code now has some bugs