improve comments
make and conditions explicit
refactor compare method to reduce complexity