tweaked goToBottom function