almost done, need to check edge cases and service