Cleaned up bintree code