final changes with bug fixes