Acceptance test working, lot of refactoring