commited most of Risto's changes.