moved format conversion to new file. Implemented SEK algorithm