Fixed a memory problem, Added keyboard interrupt