Refactor linux support