Clean up ns declarations, more idiomatic code