Minor code improvements, minor redesign