Replaced subprocess with os.remove/rename