Moved all logic to service