Region rendering seems to work

Also refactored functions and clarified constant names.