refactor read rc file with proc and lamda for readabliity