changes according to comments from bytemaster (part 2)