reorganized rc.lua for easier readability