Resolving more errors and consolidating a few functions