fisrt working version, need to workout