Added a few conditions for linux/mac specific behaviour