Fixed some lingering artifacts (from a move outside Git), and cleaned up the implementations