code refactored, changes to interface