updated to do, several bug fixes