comparison and logic operators, moved safe memory access to library