implemented double-buffer screen refresh