Fixed crash caused by status pipe handler

Changed while loop to do-while, ensuring it runs once
Refactored update_status(), updated other functions to fit