update to latest with lots of changes and function