Rename and move code for readability