final version; fixed some issues and handed in;