improved cursor support and added "r" command