cleaned code
RNTN implemented