first draft of enoder implemented