added specs and fixed bugs