updated. refactored