Implemented custom on back press key functionality