Some changes and improvements. See more in comit messages.