Updated with smarter stack controll