solved PUT-request issue. Minor refactoring