Added tenure. Changed more sqldf commands to R native commands.