Split statement and result logic out of lib.rs