refactored; some functionality: added;