made many fixes as suggested by Rachel Haider