Updated the lib including alot of chenges pointed out by @tarciozemel.