Refactor services + add tests