Some comments added, some legacy code removed