Changed the file structure to be more modular
Made the R# checks more robust

closes #1024