final version for now, still some bugs