credits for GetLastInput code snippets