attr() <- commands replaced with attributes() <- list() where possible + some comments removed