works, need to make a nice code