Huge cleanup, documentation