Changed Boolean function

Heavily changed the boolean function. It is basically completely new.
Removed commented code as well.