lots of fixes, finalizing code