made this multiplatform and put platform logic here
update darwin