Some refactoring. Added spec example