bear
cleanup
refactored to be more functional