Inital work, need to do some refactor and maybe tests