Refactor libs and tests into own directories