added (global) max_end and implement_shift functions