refactored a bit
fixed a spec