Refactor app code out of Planbox service