cleans up code, adds new spec