tweaks and errors corrected