refactored interfaces, moved the decoder to factory