udpate + refactoring