Bringing code from eegpipe repo