Border handling fixed. Mouse, arrows and 'c' key handling added