Add unit tests. Restructure headers.