changed boolean checks to use real booleans