fixed layout, refactored library ns