almost finished version. minor touches remaining