Initial coloring code - messy, poorly designed, but fast