minor refactoring and tests
minor refactoring
updated predict and split threshold logic