Add acceptance test. Refactor