Initial logic from hapi