Modified to work on linux