refactored broken code to new interface