adding specs and fixing a few bugs