updated with bug fixes