several small fixes, improved spec code, using let