Clean up the flow and variables in lib.rs and main.rs