adjusted file after input from Helhum