fixed errors, polishing included