Fixed the final bug, move y_previous outside of status check