NA-0: debug and code cleanup