lab1 fixed and adapted for linux