Clean up and document feature code