Implementing the "-r" option
Code cleanup