separate handler to simple functions