APD-7: clean up code